package com.kidedu.action;

import java.util.List;

import com.alibaba.fastjson.JSON;
import com.kidedu.entity.KClass;
import com.kidedu.entity.KGrade;
import com.kidedu.entity.KTeacher;
import com.kidedu.entity.dto.KGradeDTO;
import com.kidedu.service.IKClassService;
import com.kidedu.service.IKGradeService;

import com.kidedu.service.IKTeacherService;
import com.kidedu.util.BaseAction;
import com.kidedu.util.Pagination;
import com.kidedu.util.SpringContextUtil;

public class KGradeAction extends BaseAction {
	
	private static final long serialVersionUID = 1L;
	
	private int pageNo;

	private String gradeId;
	
	private String ClassId;
	
	private KGrade tbGrade;
	
	private IKGradeService iKGradeService = (IKGradeService) SpringContextUtil.getBean("iKGradeService");
	
	private IKClassService iKClassService = (IKClassService) SpringContextUtil.getBean("iKClassService");
	
	private IKTeacherService iKTeacherService = (IKTeacherService) SpringContextUtil.getBean("iKTeacherService");
	
	private Pagination<KGradeDTO> paginationKGradeDTO;
	
	private Pagination<KGrade> paginationKGrade;
	
	private List<KClass> kClassList;
	
	private List<KTeacher> kTeacherList;
	
	private String keyWord;
	
	private int weekNumber;
	public Pagination<KGrade> getPaginationKGrade() {
		return paginationKGrade;
	}


	public void setPaginationKGrade(Pagination<KGrade> paginationKGrade) {
		this.paginationKGrade = paginationKGrade;
	}



	public String getKeyWord() {
		return keyWord;
	}


	public void setKeyWord(String keyWord) {
		this.keyWord = keyWord;
	}


	public int getWeekNumber() {
		return weekNumber;
	}


	public void setWeekNumber(int weekNumber) {
		this.weekNumber = weekNumber;
	}


	public String deletekGradeList(){
		iKGradeService.deletekGradeList(gradeId);
		return "JSON";
	}
	

	public String selectkGradeList() {
		paginationKGradeDTO = iKGradeService.selectkGradeList(pageNo);
		kClassList = iKClassService.selectKClassList();
		kTeacherList=iKTeacherService.selectKTeacherList();
		return "JSON";
	}

	public String selectKGradeListPass()
	{
		paginationKGrade=iKGradeService.selectkGradeListPass(pageNo);
		return "JSON";
	}

	public String selectKGradeListkeyword()
	{
		paginationKGrade=iKGradeService.selectkGradeList(pageNo, keyWord);
		return "JSON";
	}

	
	public String updateGrade()
	{
		tbGrade.setGstate(true);
		iKGradeService.updateGrade(tbGrade);
		return  "JSON";
	}
	public String selectKGradeweek()
	{
		paginationKGrade=iKGradeService.selectkGradeListByW(pageNo, weekNumber);
		return "JSON";
	}
	
	public String selectKGradeClassId()
	{
		paginationKGrade=iKGradeService.selectkGradeListByC(pageNo, ClassId);
		return "JSON";
	}
	//家长查看开班情况
	//查看预设班级的相关信息、相关老师、是否开课，和孩子是否选择课程。
	public String selectkGradePreList() {
		//List<KOrder> kOrderList = iKOrderService.selectKOrderListByOsid(1);
		//paginationKGradeDTO = iKGradeService.selectkGradePreList(pageNo, kOrderList);
		return "JSON";
	}
	
	
	public String addKGrade()
	{
		 iKGradeService.addGrade(tbGrade);
		return "JSON";
	}
	public int getPageNo() {
		return pageNo;
	}


	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}


	public String getGradeId() {
		return gradeId;
	}


	public void setGradeId(String gradeId) {
		this.gradeId = gradeId;
	}


	public Pagination<KGradeDTO> getPaginationKGradeDTO() {
		return paginationKGradeDTO;
	}


	public void setPaginationKGradeDTO(Pagination<KGradeDTO> paginationKGradeDTO) {
		this.paginationKGradeDTO = paginationKGradeDTO;
	}


	public List<KClass> getkClassList() {
		return kClassList;
	}


	public void setkClassList(List<KClass> kClassList) {
		this.kClassList = kClassList;
	}


	public String getClassId() {
		return ClassId;
	}


	public List<KTeacher> getkTeacherList() {
		return kTeacherList;
	}


	public void setkTeacherList(List<KTeacher> kTeacherList) {
		this.kTeacherList = kTeacherList;
	}


	public void setClassId(String classId) {
		ClassId = classId;
	}


	public KGrade getTbGrade() {
		return tbGrade;
	}


	public void setTbGrade(KGrade tbGrade) {
		this.tbGrade = tbGrade;
	}
	
}
